FROM node:18-alpine3.18
# 修改为国内镜像源
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
#RUN echo "http://mirrors.aliyun.com/alpine/v3.10/main/" > /etc/apk/repositories
RUN apk update && apk add ca-certificates && update-ca-certificates && apk add openssl git
RUN apk update && apk add tzdata \
    && cp -r -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo "Asia/Shanghai" >  /etc/timezone
RUN rm -rf /var/cache/apk/*

RUN apk add yarn
RUN yarn config set registry https://registry.npmmirror.com && yarn config set disable-self-update-check true
WORKDIR /opt/app
COPY package.json_init package.json
#COPY yarn.lock_init yarn.lock
RUN yarn
COPY . .
#update package.json
RUN yarn
#generate web
RUN yarn run build
